﻿using Avalonia.Controls;

namespace facecat_avalonia.Views;

public partial class MainWindow : Window
{
    public MainWindow()
    {
        InitializeComponent();
        this.SizeChanged += MainWindow_SizeChanged;
    }

    public override void Show()
    {
        base.Show();
        if (this.divMain != null)
        {
            if (!double.IsNaN(this.Width) && !double.IsNaN(this.Height))
            {
                this.divMain.Width = this.Width;
                this.divMain.Height = this.Height;
            }
        }
    }

    private void MainWindow_SizeChanged(object? sender, SizeChangedEventArgs e)
    {
        if (this.divMain != null)
        {
            if (!double.IsNaN(this.Width) && !double.IsNaN(this.Height))
            {
                this.divMain.Width = this.Width;
                this.divMain.Height = this.Height;
            }
        }
    }
}
